<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<!-- saved from url=(0057)http://www.jsdaima.com/Upload/1481799768/newPassword.html -->
<html><head lang="en"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script  src="<%=path%>/statics/js/jquery-1.8.3.js" type="text/javascript"></script>
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="viewport" content="height=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <title></title>
    
    <link rel="stylesheet" href="<%=path %>/statics/newPassword_files/common.css">
    <link rel="stylesheet" href="<%=path %>/statics/newPassword_files/register.css">
    <script type="text/javascript" src="<%=path %>/statics/js/alertPopShow.js"></script>
         <link rel="stylesheet" href="<%=path %>/statics/css/sysz.css">
    <style>
        .message{
            background: none;
            padding-top: 10%;
        }
        .message input {
            width: 83%;
            margin: 0 4%;
        }
        .content form input:not(:nth-child(6)) {
            border: 0;
            margin-bottom: 8%;
        }
        .message .icons b{
            top: 14.5%;
            left: 11%;
        }
        .message .icons b:nth-child(2){
            top: 37%;
            left: 10%;
        }
        .message .icons b:nth-child(3){
            top: 60%;
        }
        .message .icons b:nth-child(4){
            top: 82%;
        }
        .code{
            top: 33.475%;
            right: 7.5%;
            background: #21a9f5;
            color: #ffffff;
            padding: 3.635% 5%;
        }
    </style>
    <script src="<%=path %>/statics/js/jquery-1.8.3.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
		function stops(){
  		 return false;
		}
		document.oncontextmenu=stops;
	</script>
	
</head>
<body>
    <div class="register">
        <div class="regTop">
            <span>忘记密码</span>
            <a class="back" href="javascript:history.back(-1);">&lt;&nbsp;返回</a>
        </div>
        <div class="content">
            <form id="frmps" action="<%=path %>/user/modifyPwd.html" method="post">
                <div class="message">
                    <input type="tel" placeholder="输入手机号" name="phone" id="phone" pattern="[0-9]{11}" required="">
                    <input type="text" placeholder="输入验证码" name="yanzheng" id="yanzheng">
                    <input type="password" placeholder="请输入新密码" name="newpassword" id="newpassword" pattern="[0-9A-Za-z]{6,25}" required="">
                    <input type="password" placeholder="请再次输入密码" name="newpassword2" id="newpassword2" pattern="[0-9A-Za-z]{6,25}" required="">
                    <div class="icons">
                        <b><img src="<%=path %>/statics/newPassword_files/zc-1.jpg" alt=""></b>
                        <b><img src="<%=path %>/statics/newPassword_files/zc-2.jpg" alt=""></b>
                        <b><img src="<%=path %>/statics/newPassword_files/zc-3.jpg" alt=""></b>
                        <b><img src="<%=path %>/statics/newPassword_files/zc-3.jpg" alt=""></b>
                    </div>
                    <a class="code" href="#" id="btn" onclick="fusaphone(this);">获取验证码</a>
                </div>
                <script type="text/javascript"> 
var bs = document.getElementById("btn");
settime(bs); 
var countdown=0; 
function settime(val) { 

if (countdown == 0) { 
val.removeAttribute("disabled");    
val.innerText="免费获取验证码"; 
countdown = 60; 
return;
} else { 
if(countdown==undefined){
val.setAttribute("disabled", true); 
val.innerText="免费获取验证码"; 

}else{
val.setAttribute("disabled", true); 
val.innerText="重新发送(" + countdown + ")"; 

countdown--;
}
 
} 
setTimeout(function() { 
settime(val) 
},1000) 
} 
</script> 
                <script type="text/javascript">
		var suiji="";
		function fusaphone(val){
			var phone=document.getElementById("phone").value;
	 var phoneReg=/^1[13578]\d{9}$/;
		if(phone==""){
		webToast("请填写手机号","middle",1000);
		return;
		}
		if(!phoneReg.test($("#phone").val())){
                     
            webToast("输入的手机号码不正确","middle",1000);
                     return ;
             }
		
			
			
		 	 $.ajax({
				type:"POST",
				url:"<%=path%>/user/getphoneapi.html",
				data:{phones:phone},
				dataType:"json",
				success:function(data){
				 var data=eval("("+data+")");
				
				
			
					if(data.res=="true"){
						suiji=data.resc;
						
					}
				},
				error:function(){  //异常
					alert("异常");
				}
			}); 
			settime(val);
		}
	</script>
	
                <button class="submit" onclick="funs()" type="button">提交</button>
            </form>
            <script type="text/javascript">
           function funs(){
            var registerkeywords = $("#newpassword2").val();
	 var phoneReg=/^1[13578]\d{9}$/;
            var pwdReg = /^[a-zA-Z]\w{5,17}$/;
		 var loginPhone = $("#phone").val().length;
		     webToast(suiji,"middle",1000);
		var s= document.getElementById("yanzheng").value;
             var loginPwd = $("#newpassword").val().length;
             if(loginPhone===0){
                 webToast("输入的手机号码不正确","middle",1000);
                 return;
             } else if(!phoneReg.test($("#phone").val())){
                     
            webToast("输入的手机号码不正确","middle",1000);
                     return ;
             }
               else if(s==""){
             webToast("验证密码为空","middle",1000);
            return;
           }     
          else if(suiji!=s){
             webToast("验证密码错误","middle",1000);
            return;
           } 
             
             else if(loginPhone!==0&&loginPwd===0){
                 
                   webToast("请输入密码","middle",1000);
                 reutrn;
             } else if(!pwdReg.test($("#newpassword").val())){
               
                 webToast("密码格式不正确","middle",1000);
                 return;
             }else if(registerkeywords==""||registerkeywords==undefined){
         
              webToast("请输入第2次密码","middle",1000);
                 return;
             }
            
             else if(registerkeywords!=$("#newpassword").val()){
              webToast("两次密码输入不一致","middle",1000);
                 return;
             }
          
           document.getElementById("frmps").submit();
            }
            </script>
        </div>
    </div>
<div class="x-qtip" style="display: none;"><div class="x-qtip-body"><div class="x-qtip-icon"><i></i></div><div class="x-qtip-msg">请输入手机号码</div></div></div>
</body></html>